﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ovvio.Data;

namespace Ovvio.Business
{
    public static class UserExtension
    {
        public static void SetPassword(this User entity, string password)
        {
            entity.Password = CryptographyService.Encrypt(password, "Pas5pr@se", "s@1tValue;", 2, "@1B2c3D4e5F6g7H8", 256);
        }

        public static string DecryptPassword(this User entity)
        {
            if (entity.Password == null)
                return string.Empty;

            return CryptographyService.Decrypt(entity.Password, "Pas5pr@se", "s@1tValue;", 2, "@1B2c3D4e5F6g7H8", 256);
        }
    }
}
